package io.litchi.auth.Infrastructure.securityentity;

import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Map;


/**
 * description: 鉴权用户信息
 *
 * @author helang
 * @since 2025-09-10
 */
@Data
@Builder
public class LitchiUser implements UserDetails {

    /**
     * id
     */
    private Long id;
    /**
     * 账号
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 短token
     */
    private String token;

    /**
     * 长token
     */
    private String refreshToken;

    /**
     * 过期时间
     */
    private Long expirationTime;

    /**
     * 续签时间
     */
    private Long refreshTime;

    /**
     * 角色、权限信息
     */
    private Collection<? extends GrantedAuthority> authorities;

    /**
     * 扩展用户信息 根据需求设置
     */
    private Map<String, Object> extUserInfo;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return username;
    }

}